<<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>Eric's 解析器</title>
    <style>
        @font-face {
            font-family: 'CustomFont';
            src: url('./1.ttf') format('truetype');
        }

        * {
            font-family: 'CustomFont', Arial, sans-serif;
        }

        body {
            background-image: url('https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/d70a0c6cf0d93540e14f6141edfc7388.jpg?x-oss-process=image/resize,m_lfit,w_1920,h_1080');
            background-size: cover;
            background-position: center;
            color: #333;
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            height: 1024px;
        }
        #container {
            width: 90%;
            max-width: 600px;
            background-color: rgba(255, 255, 255, 0.9);
            padding: 20px;
            margin: 20px 0;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            border-radius: 8px;
            position: relative;
            display: flex;
            flex-direction: column;
            min-height: 1024px;
        }
        .back-link {
            position: absolute;
            top: 20px;
            left: 20px;
        }
        .back-link img {
            width: 40px;
            height: auto;
            border-radius: 50%;
        }
        h1 {
            font-size: 24px;
            margin-bottom: 10px;
            text-align: center;
        }
        .input-group, .radio-group {
            margin-bottom: 20px;
        }
        .input-group label {
            display: block;
            margin-bottom: 5px;
        }
        .radio-group legend {
            margin-bottom: 10px;
            font-weight: bold;
        }
        .input-group .entry {
            width: 100%;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
            box-sizing: border-box;
        }
        .radio-group {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }
        .radio-group label {
            background-color: #f0f0f0;
            padding: 10px;
            border-radius: 4px;
            cursor: pointer;
            flex: 1;
            text-align: center;
            border: 1px solid transparent;
        }
        .radio-group input[type="radio"] {
            display: none;
        }
        .radio-group input[type="radio"]:checked + label {
            background-color: #007bff;
            color: white;
            border-color: #007bff;
        }
        /* 添加B站按钮选中时的样式 */
        .radio-group input[type="radio"][value="bilibili"]:checked + label {
            background-color: #FB7299;
            color: white;
            border-color: #FB7299;
        }
        .button {
            width: 100%;
            padding: 10px;
            margin: 10px 0;
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
        }
        .button:hover {
            background-color: #0056b3;
        }
        iframe {
            width: 100%;
            height: 500px;
            border: none;
            margin-top: 20px;
        }
        .night-mode {
            background-color: #333;
            color: white;
        }
        .night-mode input, .night-mode button, .night-mode label {
            background-color: #333;
            color: white;
        }
    </style>
</head>
<body onload="showAlert()">
    <div id="container" class="container">
        <h1>Eric's 解析器</h1>
        <div class="input-group">
            <label for="videoUrl">请输入网址或BV号:</label>
            <input type="text" id="videoUrl" class="entry" placeholder="支持各大VIP视频网址,支持B站BV号，如：BV1WQykY5EXt">
        </div>
        <fieldset class="radio-group">
            <legend>选择解析接口:</legend>
            <input type="radio" id="apiBili" name="api" value="bilibili">
            <label for="apiBili">B站</label>
            <input type="radio" id="api1" name="api" value="https://jx.xyflv.cc/?url=" checked>
            <label for="api1">咸鱼</label>
            <input type="radio" id="api2" name="api" value="https://jx.5566jiexi.com/?url=">
            <label for="api2">5566</label>
            <input type="radio" id="api3" name="api" value="https://jx.xmflv.com/?url=">
            <label for="api3">虾米</label>
            <input type="radio" id="api4" name="api" value="https://am1907.top/?jx=">
            <label for="api4">M1907(可输名字)</label>
            <input type="radio" id="api5" name="api" value="https://vip.bljiex.com/?v=">
            <label for="api5">BL</label>
            <input type="radio" id="api6" name="api" value="https://jx.mmkv.cn/tv.php?url=">
            <label for="api6">vip</label>
            <input type="radio" id="api7" name="api" value="https://jx.2s0.cn/player/?url=">
            <label for="api7">极速</label>
            <input type="radio" id="api8" name="api" value="https://www.yemu.xyz/?url=">
            <label for="api8">夜幕</label>
            <input type="radio" id="api9" name="api" value="https://t1.qlplayer.cyou/player/?url=">
            <label for="api9">麒麟</label>
        </fieldset>
        <button id="parseButton" class="button" onclick="parseVideo()">解析</button>
        <button id="nightModeButton" class="button" onclick="toggleNightMode()">开启黑夜模式</button>
        <iframe id="resultFrame" src="" allowfullscreen></iframe>
    </div>

    <script>
        let isNightMode = false;

        function showAlert() {
            alert('Night mode provided by this page is not recommended.\n不建议使用此页面页面提供的黑夜模式');
        }

        async function parseVideo() {
            var videoUrl = document.getElementById('videoUrl').value.trim();
            var apiRadios = document.getElementsByName('api');
            var selectedApi = '';
            
            for (var i = 0; i < apiRadios.length; i++) {
                if (apiRadios[i].checked) {
                    selectedApi = apiRadios[i].value;
                    break;
                }
            }

            if (!videoUrl) {
                alert('请输入视频网址');
                return;
            }

            // 如果选择了B站解析接口
            if (selectedApi === 'bilibili') {
                if (!videoUrl.startsWith('BV') || videoUrl.length !== 12) {
                    alert('请输入正确的BV号');
                    return;
                }
                try {
                    const response = await fetch(`https://api.injahow.cn/bparse/?bv=${videoUrl}&p=1&format=mp4&otype=json`);
                    const data = await response.json();
                    
                    if (data.code === 0 && data.url) {
                        document.getElementById('resultFrame').src = data.url;
                    } else {
                        alert('B站视频解析失败，请检查BV号是否正确');
                    }
                } catch (error) {
                    alert('解析出错，请稍后重试');
                    console.error('Error:', error);
                }
            } else {
                // 使用其他解析接口
                var apiUrl = selectedApi + encodeURIComponent(videoUrl);
                document.getElementById('resultFrame').src = apiUrl;
            }
        }

        function toggleNightMode() {
            isNightMode = !isNightMode;
            document.body.classList.toggle('night-mode', isNightMode);
            const nightModeButton = document.getElementById('nightModeButton');
            nightModeButton.textContent = isNightMode ? '关闭黑夜模式' : '开启黑夜模式';
        }
    </script>
</body>
</html>
